<template>
	<view class="content">
		<p v-html="articleDetail.content"></p>
	</view>
</template>

<script>
	import {
		getArticle
	} from "@/api/extension.js"
	export default {
		data() {
			return {
				articleDetail: {}
			}
		},
		onShareAppMessage: function() {
			return {
				title: '渡爱商城',
			}
		},
		onShareTimeline: function() {
			return {
				title: '渡爱商城',
			}
		},
		onLoad(options) {
			console.log(options, "options")
			this.getArticleDetail(options.id)
		},
		methods: {
			getArticleDetail(id) {
				getArticle(id).then(res => {
					console.log(res.data)
					this.articleDetail = res.data
					this.articleDetail.content = res.data.content.replace(/\<img/g,
						'<img style="max-width:100%;height:auto"')
				})
			}
		}
	}
</script>

<style lang="scss">
	@import '@/uni.scss'; // 导入全局 SCSS 变量文件

	.content {
		min-height: 100vh;
		background-color: $uni-bg-color-grey;
	}
</style>